package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 根据菜品id查询套餐id
     * @param dishIds
     * @return
     */
    //select setmeal_id from setmeal_dish where dish_id in (?,?,?)
    List<Long> getSetmealIdsByDishId(List<Long> dishIds);

    /**
     * 添加菜品到套餐
     * @param setmealDishes
     */
    void addSetmealDishes(List<SetmealDish> setmealDishes);

    /**
     * 根据id删除套餐菜品
     * @param id
     */
    void deleteById(Long id);

    /**
     * 根据套餐id查询套餐菜品
     * @param setmealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id=#{setmealId}")
    List<SetmealDish> getSetmealIdByDishId(Long setmealId);
}
